package com.yhally.eureka.controller;

import com.yhally.eureka.common.CommonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@RequestMapping("/test")
public class TestController {

    public static final String url = "http://EUREKA-SERVICE-PROVIDER";

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/echo")
    public CommonResult echoProvider() {
        return restTemplate.getForObject(url + "/echo/sayHello", CommonResult.class);
    }
}
